In recent years, object-oriented program languages such as the Java (trademark) language have widely been used. A program written in such a language performs computations and input/output operations by using an object as a unit. In other words, a program execution system dynamically generates various objects in response to the commands of a program along with the execution of the program. The generated objects are stored in an area called heap in a memory.
In order to efficiently store and manage objects, it is preferable to reduce idle and redundant objects as much as possible. The idle object means an object the whole or a part of which is no longer used. The redundant object means an object that is the same as another object at least partially. It is known that a state where such idle objects exist is solved through the application of a memory management technique such as garbage collection (hereinafter, referred to as GC).
One conceivable method for solving the redundancy of objects is to integrate references to a plurality of redundant objects into a reference to one of these objects, for example. If an object is an immutable object having content that will surely never be changed, this conceivable method is especially effective to solve the redundancy of objects. In other words, in the execution of a program after the reference integration, the program can keep using an object whose references have been integrated, as if the object were each of a plurality of objects before the integration.
Please refer to Japanese Patent Application Laid-open Publication No. 2001-184219 for the technique related to GC, and Japanese Patent Application Laid-open Publication No. 2003-256209 for the management of character string data in a device which executes an object-oriented program.
In order to solve the redundancy of objects, the following processing, for example, may be performed when a new object is generated. An execution system: (1) searches a heap to find another object having the same content as the new object, and (2) if such an object is found, generates a reference to the found object instead of a reference to the new object. This generated reference makes it unnecessary to generate the new object. Moreover, even if the new object is generated, a memory area occupied by the new object is freed up afterward, since there is no reference to the new object.
However, the search processing of the above (1) takes a time corresponding to the number of already-generated objects. This processing can be made efficient by use of a data structure such as a hash table, but it still takes some time. Moreover, some objects will get out of use in a short time after its generation. Solving of the redundancy of such objects requires such a lot of time, but brings too little effect. In other words, it is more efficient to collect such objects by GC after the objects get out of use, rather than spending a long time for a search to solve the redundancy.